﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using Kaiser.Models;
using Kaiser.Services;
using Kaiser.Extensions;
namespace Kaiser.Modules.Admin.Extensions
{
    public static class IUserServiceExtensions
    {
        public static User GetNormalUser(this IUserService userService, string username, string password)
        {
            User user = userService.GetItem(username);

            if (user != null)
            {
                string currentPassword = user.Password;

                if (!currentPassword.IsNullOrWhiteSpace())
                {
                    if (currentPassword == password)
                        return user;
                }
            }

            return null;
        }
    }
}
